using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using GameVuTru.ResourceManager;
using GameVuTru.ManagerScreens;
namespace GameVuTru.GameObject
{
    public class Explore : CObject
    {
        EXPLOSIONTYPE typeExplosion;
        public Explore(EXPLOSIONTYPE type, Vector2 pos)
        {
            if (type == EXPLOSIONTYPE.SLIVEREXPLOSION)
            {
                m_sprite = new CSprite(ReSouce.sliverexplosion, 20, 5, 350, 280);
            }
            if (type == EXPLOSIONTYPE.YELLOWEXPLOSION)
            {
                m_sprite = new CSprite(ReSouce.yellowexplosion, 20, 5, 350, 280);
            }
            if (type == EXPLOSIONTYPE.REDEXPLOSION)
            {
                m_sprite = new CSprite(ReSouce.redexplosion, 20, 5, 350, 280);
            }
            if (type == EXPLOSIONTYPE.DUCKEXPLOSION)
            {
                m_sprite = new CSprite(ReSouce.duckexplosion, 9, 9, 450, 70);
            }
            if (type == EXPLOSIONTYPE.PLAYEREXPLOSION)
            {
                m_sprite = new CSprite(ReSouce.playerexplosion, 9, 9, 900, 100);
            }
            if (type == EXPLOSIONTYPE.BOOMEXPLOSION)
            {
                m_sprite = new CSprite(ReSouce.boomexplosion, 9, 9, 1800, 200);
            }
            typeExplosion = type;
            postion = pos;
            isvisible = true;

        }
        public override void Update(GameTime gametime)
        {
            if (isvisible)
            {
               
                if (typeExplosion == EXPLOSIONTYPE.DUCKEXPLOSION || typeExplosion == EXPLOSIONTYPE.PLAYEREXPLOSION)
                {
                    m_sprite.UpdateSprite(1, gametime, 0, 8, 1);
                    if (m_sprite.currentsprite == 8)
                    {
                        isvisible = false;
                    }
                }
                else
                {
                    m_sprite.UpdateSprite(1, gametime, 0, 19, 1);
                    if (m_sprite.currentsprite == 19)
                    {
                        isvisible = false;
                    }
                }
            }
            if (typeExplosion == EXPLOSIONTYPE.BOOMEXPLOSION)
            {
                m_sprite.UpdateSprite(666, gametime, 0, 8, 1);
                if (m_sprite.currentsprite == 8)
                {
                    isvisible = false;
                }
            }
            base.Update(gametime);

        }
        public override void Draw(SpriteBatch sp)
        {
            if (isvisible)
                base.Draw(sp);

        }
    }
}
